#ifndef _BOARD_CONFIG_H_
#define _BOARD_CONFIG_H_

#include <driver/gpio.h>
#include <driver/uart.h>


#define AUDIO_INPUT_SAMPLE_RATE  16000
#define AUDIO_OUTPUT_SAMPLE_RATE 24000

// 如果使用 Duplex I2S 模式，请注释下面一行
#define AUDIO_I2S_METHOD_SIMPLEX

#define AUDIO_I2S_MIC_GPIO_SCK  GPIO_NUM_42
#define AUDIO_I2S_MIC_GPIO_DIN  GPIO_NUM_41
#define AUDIO_I2S_SPK_GPIO_DOUT GPIO_NUM_3
#define AUDIO_I2S_SPK_GPIO_BCLK GPIO_NUM_1
#define AUDIO_I2S_SPK_GPIO_LRCK GPIO_NUM_2
#define AUDIO_I2S_SPK_GPIO_GAIN GPIO_NUM_4



#define BUILTIN_LED_GPIO        GPIO_NUM_NC
#define BOOT_BUTTON_GPIO        GPIO_NUM_0
#define VOLUME_UP_BUTTON_GPIO   GPIO_NUM_NC
#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_NC

//#define CONFIG_DISPLAY_USE_ST7789 1
#define CONFIG_DISPLAY_USE_JBD013 1

#ifdef CONFIG_DISPLAY_USE_JBD013
#define DISPLAY_WIDTH   640 
#define DISPLAY_HEIGHT  480
#define DISPLAY_DC_GPIO     GPIO_NUM_NC
#define DISPLAY_CS_GPIO     GPIO_NUM_43 //fake cs, real  C:\Users\Administrator\esp\v5.4.1\esp-idf\components\esp_lcd\src\esp_lcd_panel_jbd013.c
#define DISPLAY_CLK_GPIO    GPIO_NUM_7
#define DISPLAY_MOSI_GPIO   GPIO_NUM_9
#define DISPLAY_RST_GPIO    GPIO_NUM_NC

#elif 

#define DISPLAY_WIDTH   240
#define DISPLAY_HEIGHT  240
#define DISPLAY_DC_GPIO     GPIO_NUM_8
#define DISPLAY_CS_GPIO     GPIO_NUM_44
#define DISPLAY_CLK_GPIO    GPIO_NUM_7
#define DISPLAY_MOSI_GPIO   GPIO_NUM_9
#define DISPLAY_RST_GPIO    GPIO_NUM_NC

#endif


#define DISPLAY_MIRROR_X false
#define DISPLAY_MIRROR_Y false
#define DISPLAY_SWAP_XY false

#define DISPLAY_OFFSET_X  0
#define DISPLAY_OFFSET_Y  0



#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_NC
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT false

#define UART_ECHO_TXD GPIO_NUM_38
#define UART_ECHO_RXD GPIO_NUM_48
#define UART_ECHO_RTS (-1)
#define UART_ECHO_CTS (-1)

#define MOTOR_SPEED_MAX 100
#define MOTOR_SPEED_80  80
#define MOTOR_SPEED_60  60
#define MOTOR_SPEED_MIN 0

#define ECHO_UART_PORT_NUM      UART_NUM_1
#define ECHO_UART_BAUD_RATE     (115200)
#define BUF_SIZE                (1024)

typedef enum {
    LIGHT_MODE_CHARGING_BREATH = 0,
    LIGHT_MODE_POWER_LOW,
    LIGHT_MODE_ALWAYS_ON,
    LIGHT_MODE_BLINK,
    LIGHT_MODE_WHITE_BREATH_SLOW,
    LIGHT_MODE_WHITE_BREATH_FAST,
    LIGHT_MODE_FLOWING,
    LIGHT_MODE_SHOW,
    LIGHT_MODE_SLEEP,
    LIGHT_MODE_MAX
} light_mode_t;

/* Camera PINs*/
#define XIAO_CAMERA_XCLK      (GPIO_NUM_10)
#define XIAO_CAMERA_PCLK      (GPIO_NUM_13)
#define XIAO_CAMERA_VSYNC     (GPIO_NUM_38)
#define XIAO_CAMERA_HSYNC     (GPIO_NUM_47)
#define XIAO_CAMERA_D0        (GPIO_NUM_15)
#define XIAO_CAMERA_D1        (GPIO_NUM_17)
#define XIAO_CAMERA_D2        (GPIO_NUM_18)
#define XIAO_CAMERA_D3        (GPIO_NUM_16)
#define XIAO_CAMERA_D4        (GPIO_NUM_14)
#define XIAO_CAMERA_D5        (GPIO_NUM_12)
#define XIAO_CAMERA_D6        (GPIO_NUM_11)
#define XIAO_CAMERA_D7        (GPIO_NUM_48)

#define XIAO_CAMERA_PWDN      (GPIO_NUM_NC)
#define XIAO_CAMERA_RESET     (GPIO_NUM_NC)
#define XIAO_CAMERA_XCLK      (GPIO_NUM_10)
#define XIAO_CAMERA_PCLK      (GPIO_NUM_13)
#define XIAO_CAMERA_VSYNC     (GPIO_NUM_38)
#define XIAO_CAMERA_HSYNC     (GPIO_NUM_47)

#define XIAO_CAMERA_XCLK_FREQ (16000000)
#define XIAO_LEDC_TIMER       (LEDC_TIMER_0)
#define XIAO_LEDC_CHANNEL     (LEDC_CHANNEL_0)

#define XIAO_CAMERA_SIOD      (GPIO_NUM_40)
#define XIAO_CAMERA_SIOC      (GPIO_NUM_39)

#endif // _BOARD_CONFIG_H_
